﻿using mqtt.client.test.Mqtt;
using mqtt.client.test.Mqtt.Connect;
using mqtt.client.test.Mqtt.Constant;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using mqtt.client.test.Constant;
using XjjXmm.Infrastructure.Common;
using XjjXmm.Infrastructure.Exceptions;
using static System.Runtime.InteropServices.JavaScript.JSType;

namespace mqtt.client.test.Input;

internal class PublishCompleteInput : AbstractDataPacket
{
    private readonly byte msb;
    private readonly byte lsb;

    public PublishCompleteInput(int packetIdentifier)
    {
        msb = (byte)(packetIdentifier >> 8);
        lsb = (byte)(packetIdentifier & 255);
    }

    protected override void PushHeaders()
    {
        byte header = PacketType.PUBCOMP << 4 | HeaderFlag.PUBCOMP;

        Data.Add(header);
    }

    protected override void PushRemainingLength()
    {
        Data.Add(0x02);
    }

    protected override void PushVariableHeader()
    {
        Data.Add(msb);
        Data.Add(lsb);
    }

    protected override void PushPayload()
    {

    }

}
